/**
 * 
 */
package com.dwa.domain.service;

import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.dwa.domain.INews;
import com.dwa.persistent.PersistentException;
import com.dwa.persistent.dao.INewsDao;


/**
 * @author Vedamoorthi Vairam
 * @since 09/02/2009
 */
public class NewsAppService implements INewsAppService {

	private static final Logger logger = Logger.getLogger(NewsAppService.class);
	
	@Autowired
	private INewsDao newsDao;

	public void setNewsDao(INewsDao newsDao) {
		this.newsDao = newsDao;
	}

		
	
	public INews createNews(INews news) throws DomainException {
		try {
			return newsDao.createNews(news);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
			
	}

	public INews updateNews() throws DomainException {
		try {
			return newsDao.updateNews();
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public INews deleteNews() throws DomainException {
		try {
			return newsDao.deleteNews();
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public INews getNewsByNewsId(Long newsId) throws DomainException {
		try {
			return newsDao.getNewsByNewsId(newsId);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}
	
	public List<INews> getNewsByNewsDate(Date date) throws DomainException  {
		try {
			return newsDao.getNewsByNewsDate(date);
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}

	public List<INews> getNews() throws DomainException
	{
		try 
		{
			return newsDao.getNews();
		} catch (PersistentException e) {
			throw new DomainException(e);
		}
	}


}
